
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 08/13/2014 20:28:49
-- Generated from EDMX file: C:\TFS Projects\squadwuschel\DiTemplates\MVC\DiNinject\DiNinject.EfModel\EFModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [diNinject];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_PersonAuto]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AutoSet] DROP CONSTRAINT [FK_PersonAuto];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PersonSet]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PersonSet];
GO
IF OBJECT_ID(N'[dbo].[AutoSet]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AutoSet];
GO
IF OBJECT_ID(N'[dbo].[AdresseSet]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AdresseSet];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'PersonSet'
CREATE TABLE [dbo].[PersonSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Vorname] nvarchar(max)  NOT NULL,
    [Nachname] nvarchar(max)  NOT NULL,
    [Alter] int  NOT NULL,
    [Benutzername] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'AutoSet'
CREATE TABLE [dbo].[AutoSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Marke] nvarchar(max)  NOT NULL,
    [Nummernschild] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'AdresseSet'
CREATE TABLE [dbo].[AdresseSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Strasse] nvarchar(max)  NOT NULL,
    [Hausnummer] nvarchar(max)  NOT NULL,
    [Ort] nvarchar(max)  NOT NULL,
    [Plz] nvarchar(max)  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'PersonSet'
ALTER TABLE [dbo].[PersonSet]
ADD CONSTRAINT [PK_PersonSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'AutoSet'
ALTER TABLE [dbo].[AutoSet]
ADD CONSTRAINT [PK_AutoSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'AdresseSet'
ALTER TABLE [dbo].[AdresseSet]
ADD CONSTRAINT [PK_AdresseSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------